package com.zxt.utils;//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class ZXTCollectionsUtil {
    public ZXTCollectionsUtil() {
    }

    public static boolean isEmpty(Collection<?> collection) {
        return collection == null || collection.isEmpty();
    }

    public static boolean isNotEmpty(Collection<?> collection) {
        return !isEmpty(collection);
    }

    public static <T> boolean isEmpty(T[] array) {
        return array == null || array.length == 0;
    }

    public static <T> boolean isNotEmpty(T[] array) {
        return !isEmpty(array);
    }

    public static boolean isEmpty(Map<?, ?> map) {
        return map == null || map.isEmpty();
    }

    public static boolean isNotEmpty(Map<?, ?> map) {
        return !isEmpty(map);
    }

    public static <T> List<T> asList(T... list) {
        return (List) (isEmpty(list) ? new ArrayList() : (List) Stream.of(list).collect(Collectors.toList()));
    }

    public static String toString(Collection<?> collection, CharSequence delimiter) {
        if (isEmpty(collection)) {
            return null;
        } else {
            StringJoiner joiner = new StringJoiner(delimiter);
            Iterator var3 = collection.iterator();

            while (var3.hasNext()) {
                Object object = var3.next();
                joiner.add(String.valueOf(object));
            }

            return joiner.toString();
        }
    }
}
